﻿@{
    ViewBag.Title = "Details"; 
    Layout = "~/Views/Shared/_Form.cshtml";
}
<script>
    layui.use(['jquery', 'form', 'laydate', 'tablePlug', 'common'], function () {
        var form = layui.form,
            $ = layui.$,
            common = layui.common,
            laydate = layui.laydate;
        var keyValue = $.request("keyValue");
        //权限字段
        common.authorizeFields('adminform');
        //此处需修改
        //类型为时间时
        //laydate.render({
            //elem: '#F_Birthday'
            //, btns: ['clear', 'now']
            //, trigger: 'click',
            //format: 'yyyy-MM-dd',
        //});

        $(function () {
            initControl();
            common.ajax({
                url: '/ContentManage/ArticleNews/GetFormJson',
                dataType: 'json',
                data: { keyValue: keyValue },
                async: false,
                success: function (data) {
                    common.val('adminform', data);
                    var Description = data.Description;

                    if (!!data.ImgUrl) {
                        ImgUrlPic.src = data.ImgUrl;
                    }
                    // editor准备好之后才可以使用
                    var editor = UE.getEditor("Description");
                    editor.ready(function () {
                        editor.setContent(Description);
                        editor.setDisabled();//不可编辑
                    });
                    common.setReadOnly('adminform');
                    form.render();
                 }
            });
       });

       function initControl() {
           //此处需修改
           //绑定数据源
           //类型为下拉框时
       }
   });
</script>

<body>
    <div class="layuimini-container">
        <div class="layuimini-main">
            <div class="layui-form layuimini-form" lay-filter="adminform">
                <div class="layui-tab">
                    <ul class="layui-tab-title">
                        <li class="layui-this">基本信息</li>
                        <li>详细描述</li>
                        <li>SEO选项</li>
                    </ul>
                    <div class="layui-tab-content">
                        <div class="layui-tab-item layui-show">
                            <div class="layui-form-item layui-hide">
                                <label class="layui-form-label required">新闻类别</label>
                                <div class="layui-input-block">
                                    <input type="text" id="CategoryName" name="CategoryName" autocomplete="off" lay-verify="required" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item layui-hide">
                                <label class="layui-form-label required">内容标题</label>
                                <div class="layui-input-block">
                                    <input type="text" id="Title" name="Title" autocomplete="off" lay-verify="required" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item layui-hide">
                                <label class="layui-form-label">URL链接</label>
                                <div class="layui-input-block">
                                    <input type="text" id="LinkUrl" name="LinkUrl" autocomplete="off" class="layui-input" placeholder="填写后直接跳转到该网址">
                                </div>
                            </div>
                            <div class="layui-form-item layui-hide">
                                <label class="layui-form-label">封面图片</label>
                                <div class="layui-input-block">
                                    <input type="text" class="layui-input" name="ImgUrl" id="ImgUrl" readonly="readonly">
                                    <img id="ImgUrlPic" src="~/images/no-image.jpg" width="200" height="200" onclick="previewImg(this)" />
                                </div>
                            </div>
                            <div class="layui-form-item layui-hide">
                                <label class="layui-form-label required">排序数字</label>
                                <div class="layui-input-block">
                                    <input type="text" id="SortCode" name="SortCode" autocomplete="off" lay-verify="required" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item layui-hide">
                                <label class="layui-form-label">选项</label>
                                <div class="layui-input-block">
                                    <input id="IsTop" name="IsTop" type="checkbox" value="true" title="是否置顶">
                                    <input id="IsRed" name="IsRed" type="checkbox" value="true" title="是否热门">
                                    <input id="IsHot" name="IsHot" type="checkbox" value="true" title="是否推荐">
                                    <input id="EnabledMark" name="EnabledMark" type="checkbox" value="true" checked="checked" title="是否发布">
                                </div>
                            </div>
                            <div class="layui-form-item layui-hide">
                                <label class="layui-form-label">点击次数</label>
                                <div class="layui-input-block">
                                    <input type="text" id="Click" name="Click" autocomplete="off" value="0" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-tab-item">
                            <div class="layui-form-item layui-hide">
                                <label class="layui-form-label">摘要</label>
                                <div class="layui-input-block">
                                    <input type="text" id="Zhaiyao" name="Zhaiyao" autocomplete="off" class="layui-input" placeholder="不填写则自动截取内容前255字符">
                                </div>
                            </div>
                            <div class="layui-form-item layui-hide">
                                <label class="layui-form-label required">来源</label>
                                <div class="layui-input-block">
                                    <input type="text" id="Source" name="Source" autocomplete="off" lay-verify="required" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item layui-hide">
                                <label class="layui-form-label required">作者</label>
                                <div class="layui-input-block">
                                    <input type="text" id="Author" name="Author" autocomplete="off" lay-verify="required" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item layui-hide">
                                <label class="layui-form-label required">内容描述</label>
                                <div class="layui-input-block">
                                    <textarea id="Description" name="Description" type="text/plain" style="width:100%;height:450px;">
                                    </textarea>
                                </div>
                            </div>
                        </div>
                        <div class="layui-tab-item">
                            <div class="layui-form-item layui-hide">
                                <label class="layui-form-label required">Seo标题</label>
                                <div class="layui-input-block">
                                    <input type="text" id="SeoTitle" name="SeoTitle" autocomplete="off" lay-verify="required" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item layui-hide">
                                <label class="layui-form-label required">Seo关键字</label>
                                <div class="layui-input-block">
                                    <input type="text" id="SeoKeywords" name="SeoKeywords" autocomplete="off" lay-verify="required" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item layui-hide">
                                <label class="layui-form-label required">Seo描述</label>
                                <div class="layui-input-block">
                                    <input type="text" id="SeoDescription" name="SeoDescription" autocomplete="off" lay-verify="required" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item layui-hide">
                                <label class="layui-form-label">Tags标签</label>
                                <div class="layui-input-block">
                                    <input type="text" id="Tags" name="Tags" autocomplete="off" class="layui-input" placeholder="多个可用英文逗号分隔开，如：a,b">
                                </div>
                            </div>


                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <link href="~/lib/ueditor/themes/default/css/ueditor.css" rel="stylesheet" />
    <script type="text/javascript" charset="utf-8" src="~/lib/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="~/lib/ueditor/ueditor.all.min.js"></script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="~/lib/ueditor/lang/zh-cn/zh-cn.js"></script>

    <script type="text/javascript">
        // 加载 ueditor，传入的初始化参数可以覆盖掉 ueditor.config.js 中的配置
        // 对于同一项目中使用不同的配置的 ueditor 场景非常有用
        var ue = UE.getEditor('F_Description', {
            initialFrameHeight: 300
            // , initialFrameWidth:796
            , wordCount: false
        });
    </script>
</body>

